package com.nb.protocol.service;

import com.nb.protocol.db.GpsDao;
import com.nb.protocol.db.PostureDao;
import com.nb.protocol.protocol.MessageHolder;
import com.nb.protocol.protocol.ProtocolHeader;

import java.sql.SQLException;

/**
 * @function:
 * @author: hjw
 * @date: 2018/1/21
 * @company: Sinoregal
 * @copyright: 2018 www.sinoregal.cn. All rights reserved.
 */
public class GpsService extends BaseSesorService {
    public void reportData(MessageHolder messageHolder){
        switch (messageHolder.getFrame()){
            case ProtocolHeader.REGISTER:
                success(messageHolder);
                break;
            case ProtocolHeader.REPORT_DATE:
                try {
                    GpsDao.reportData(messageHolder);
                    success(messageHolder);
                } catch (SQLException e) {
                    fail(messageHolder);
                }
                break;

        }

    }
}
